package com.leyou.auth.config;

import com.leyou.auth.task.IntervalTokenHolder;
import feign.RequestInterceptor;
import feign.RequestTemplate;

/**
 * @author 虎哥
 */
// @Configuration
public class FeignConfig {

    // @Bean
    public RequestInterceptor requestInterceptor(IntervalTokenHolder tokenHolder){
        return new RequestInterceptor() {
            @Override
            public void apply(RequestTemplate template) {
                // 添加token到头信息中
                template.header("heima95", tokenHolder.getToken());
            }
        };
    }
}
